﻿using System;
using System.Globalization;
using System.Windows.Data;
namespace Helpers.Converters
{
    public class InchesToFeet : IValueConverter
    {
        public object Convert(object value, Type targetType,
            object parameter, CultureInfo culture)
        {
            double inches = 0;
            if (!double.TryParse(value.ToString(), out inches))
                return "";

            return string.Format("{0:0}' {1}\"", (inches / 12), Math.Round((inches % 12), 1));
        }

        public object ConvertBack(object value, Type targetType,
            object parameter, CultureInfo culture)
        {
            return 0;
        }
    }

}